<template>
	<div style="width:100%">
		<div id="mainde" style="min-width: 100%;height:280px;"></div>
	</div>
</template>

<script>
	import * as echarts from 'echarts';
	export default {
		name:"tubiaoe",
		props: ['jieyueliangmsg'],
		  data(){
			  return{
			  	tongjimsg:{},
				datelist:[],
				jielist:[],
				huanlist:[],
			  }
		  },
		  watch:{
			  jieyueliangmsg(oldval,newval){
				  this.getmsg()
			  }
		  },
		  created () {
			
		  },
		  mounted(){
			this.getmsg()
		  },
		  methods:{
			  async getmsg(){
				  this.tongjimsg=this.jieyueliangmsg
				  this.datelist=[]
				  this.jielist=[]
				  this.huanlist=[]
				  for(let item of this.tongjimsg){
					  this.datelist.push(item.name)
					   this.jielist.push(item.jie_num) // 敏感
					   this.huanlist.push(item.huan_num) // 非敏感
				  }
				  console.log( '你好',this.datelist)
				  // this.jiemsg=this.jieyuemsg
				  let that =this
					  setTimeout(res=>{
						  that.getbiao()
					  },500)
					 
				  
				  
			  },
			  getbiao(){
				let a = this.datelist
				let b = this.jielist
				let c = this.huanlist
				
				// let b=this.jiemsg.borrow_zhanbi
				
				  // console.log('这是a',b)
				var myChart = echarts.init(document.getElementById('mainde'));
				let option = {
				  xAxis: {
				    type: 'category',
				    data: this.datelist
				  },
				  yAxis: {
				    type: 'value',
					name: '舆情量/篇',
				  },
				  series: [
				    {
				      data: this.jielist,
				      type: 'line',
				      smooth: true
				    }
				  ]
				};	
				        // 使用刚指定的配置项和数据显示图表。
				        myChart.setOption(option);
			  }
		  },
		
	}
</script>

<style>
</style>